package com.woniu.user.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniu.crowd.client.SelectManageClient;
import com.woniu.crowd.client.param.AddSelectApplyParam;
import com.woniu.crowd.client.param.AddUserOpinionParam;
import com.woniu.result.Result;
import com.woniu.user.client.UserSelectManageClient;
import com.woniu.user.client.param.UserAddSelectApplyParam;
import com.woniu.user.client.param.UserAddUserOpinionParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@Slf4j
public class UserSelectQueryApiImpl implements UserSelectManageClient {

    @Resource
    private SelectManageClient selectManageClient;

    /**
     * 用户参与甄选
     * @param addSelectApplyParam
     * @return
     */
    @Override
    public Result userApplySelect(UserAddSelectApplyParam addSelectApplyParam) {
        AddSelectApplyParam userAddSelectApplyParam1 = BeanUtil.copyProperties(addSelectApplyParam, AddSelectApplyParam.class);
        return  selectManageClient.userApplySelect(userAddSelectApplyParam1);
    }

    /**
     * 上传甄选测评文件
     * @param file
     * @return
     * @throws IOException
     */
    @Override
    public Result SelectuploadFile(MultipartFile file) throws IOException {
        return selectManageClient.SelectuploadFile(file);
    }
    /**
     * 用户甄选意见上传
     * @param userOpinionParam
     * @return
     */
    @Override
    public Result userAddOpinion(UserAddUserOpinionParam userOpinionParam) {
        AddUserOpinionParam addUserOpinionParam = BeanUtil.copyProperties(userOpinionParam, AddUserOpinionParam.class);
        return selectManageClient.userAddOpinion(addUserOpinionParam);
    }
}
